home *** CD-ROM | disk | FTP | other *** search
/ Holt Researcher: American History / Holt Researcher: American History.iso / pc / modules / memmon.dxr / 00022_Main.ls < prev    next >
Encoding:
Text File  |  2000-01-14  |  4.8 KB  |  201 lines

  1. on startMovie
  2.   CheckForValidName()
  3.   InitGlobals()
  4.   InitConditions()
  5.   InitPuppets()
  6. end
  7.  
  8. on CheckForValidName
  9.   nothing()
  10. end
  11.  
  12. on InitGlobals
  13.   global gBar, gOtherBar, gStartCast, gEndCast, gStartFrame, gEndFrame, gLevel, gTemp, gTempo
  14.   gBar = 10
  15.   gOtherBar = 26
  16.   gStartCast = field("CastStart").value
  17.   gEndCast = field("CastEnd").value
  18.   gStartFrame = field("FrameStart").value
  19.   gEndFrame = field("FrameEnd").value
  20.   gTemp = 0
  21.   gTempo = 5
  22.   gLevel = 2
  23. end
  24.  
  25. on InitConditions
  26.   set the floatPrecision to 3
  27. end
  28.  
  29. on InitPuppets
  30.   global gBar
  31.   puppetSprite(gBar, 1)
  32.   puppetSprite(gOtherBar, 1)
  33.   puppetSprite(29, 1)
  34.   puppetSprite(30, 1)
  35.   puppetSprite(31, 1)
  36.   puppetSprite(32, 1)
  37.   puppetSprite(33, 1)
  38.   puppetSprite(34, 1)
  39. end
  40.  
  41. on dome
  42.   global gLevel
  43.   UpdateGraph()
  44.   if gLevel > 1 then
  45.     UpdateFields()
  46.   end if
  47. end
  48.  
  49. on UpdateGraph
  50.   global gBar, gOtherBar
  51.   set the height of sprite gBar to (cast("border").height * (the freeBytes * 1.0) / the memorysize) + 1.0
  52.   set the height of sprite gOtherBar to (cast("border").height * (the freeBlock * 1.0) / the memorysize) + 1.0
  53. end
  54.  
  55. on UpdateFields
  56.   put the memorysize & " = " & the memorysize / 1024 & "k" into field "memsize"
  57.   put the freeBytes & " = " & the freeBytes / 1024 & "k" into field "freebytes"
  58.   put the freeBlock & " = " & the freeBlock / 1024 & "k" into field "freeblock"
  59.   put the memorysize - the freeBytes & " = " & (the memorysize - the freeBytes) / 1024 & "k" into field "MemUsed"
  60. end
  61.  
  62. on GetValues
  63.   global gStartCast, gEndCast, gStartFrame, gEndFrame, gTemp
  64.   gStartCast = field("CastStart").value
  65.   gEndCast = field("CastEnd").value
  66.   gStartFrame = field("FrameStart").value
  67.   gEndFrame = field("FrameEnd").value
  68.   tell the stage
  69.     gTemp = the number of castMembers
  70.   end tell
  71.   if gEndCast > gTemp then
  72.     gEndCast = gTemp
  73.   end if
  74. end
  75.  
  76. on startTimer
  77.   return the ticks
  78. end
  79.  
  80. on PutTime now
  81.   delta = the ticks - now
  82.   put "ticks = " & delta into field "delta t"
  83.   put RETURN & "secs = " & delta / 60.0 after field "delta t"
  84. end
  85.  
  86. on InitTime
  87.   global gNow
  88.   gNow = the ticks
  89. end
  90.  
  91. on CheckTime
  92.   global gNow
  93.   put the ticks - gNow
  94. end
  95.  
  96. on DoRight
  97.   set the castNum of sprite the clickOn to the number of member "Left"
  98.   wind = window("memmon")
  99.   leftSide = getAt(wind.rect, 1)
  100.   topSide = getAt(wind.rect, 2)
  101.   rightSide = getAt(wind.rect, 3)
  102.   bottomSide = getAt(wind.rect, 4)
  103.   wind.rect = rect(leftSide, topSide, rightSide + 128, bottomSide)
  104. end
  105.  
  106. on DoLeft
  107.   set the castNum of sprite the clickOn to the number of member "Right"
  108.   wind = window("memmon")
  109.   leftSide = getAt(wind.rect, 1)
  110.   topSide = getAt(wind.rect, 2)
  111.   rightSide = getAt(wind.rect, 3)
  112.   bottomSide = getAt(wind.rect, 4)
  113.   wind.rect = rect(leftSide, topSide, rightSide - 128, bottomSide)
  114. end
  115.  
  116. on DoUp arrow
  117.   if voidp(arrow) then
  118.     set the castNum of sprite the clickOn to the number of member "down"
  119.   else
  120.     set the castNum of sprite 29 to 0
  121.     updateStage()
  122.   end if
  123.   wind = window("memmon")
  124.   leftSide = getAt(wind.rect, 1)
  125.   topSide = getAt(wind.rect, 2)
  126.   rightSide = getAt(wind.rect, 3)
  127.   bottomSide = getAt(wind.rect, 4)
  128.   wind.rect = rect(leftSide, topSide, rightSide, bottomSide - 86)
  129. end
  130.  
  131. on DoDown arrow
  132.   if voidp(arrow) then
  133.     set the castNum of sprite the clickOn to the number of member "up"
  134.   else
  135.     set the castNum of sprite 29 to the number of member "up"
  136.   end if
  137.   wind = window("memmon")
  138.   leftSide = getAt(wind.rect, 1)
  139.   topSide = getAt(wind.rect, 2)
  140.   rightSide = getAt(wind.rect, 3)
  141.   bottomSide = getAt(wind.rect, 4)
  142.   wind.rect = rect(leftSide, topSide, rightSide, bottomSide + 86)
  143. end
  144.  
  145. on GetMainMovieName
  146.   global gMovie
  147.   tell the stage
  148.     gMovie = the movieName
  149.   end tell
  150.   put gMovie into field "Moviename"
  151. end
  152.  
  153. on ResetTabButtons
  154.   set the backColor of sprite 31 to 250
  155.   set the backColor of sprite 32 to 245
  156.   set the backColor of sprite 33 to 245
  157.   set the backColor of sprite 34 to 245
  158. end
  159.  
  160. on TurnOffDepthPuppets
  161.   repeat with temp = 13 to 17
  162.     puppetSprite(temp, 0)
  163.   end repeat
  164. end
  165.  
  166. on TurnOffVolumePuppets
  167.   repeat with temp = 35 to 40
  168.     puppetSprite(temp, 0)
  169.     puppetSprite(temp, 0)
  170.   end repeat
  171. end
  172.  
  173. on UpdateMeters
  174.   mainVolHeight = 64 - (9 * the soundLevel)
  175.   set the height of sprite 35 to mainVolHeight
  176.   set the locV of sprite 38 to 69 + mainVolHeight - 3
  177.   mainVolHeight = 64 - (0.251 * the volume of sound 1)
  178.   set the height of sprite 36 to mainVolHeight
  179.   set the locV of sprite 39 to 69 + mainVolHeight - 3
  180.   mainVolHeight = 64 - (0.251 * the volume of sound 2)
  181.   set the height of sprite 37 to mainVolHeight
  182.   set the locV of sprite 40 to 69 + mainVolHeight - 3
  183. end
  184.  
  185. on Memmon
  186.   go(1)
  187.   window("memmon").rect = window("memmon").sourceRect
  188.   open(window("memmon"))
  189. end
  190.  
  191. on InitTempoIndicator
  192.   global gTempo
  193.   puppetSprite(22, 0)
  194.   puppetSprite(22, 1)
  195.   set the locV of sprite 22 to the bottom of sprite 21 - (gTempo * 3) - 1
  196. end
  197.  
  198. on TurnOffTempoPuppets
  199.   puppetSprite(22, 0)
  200. end
  201.